<!--
 * @Description: 设置平台预算
 * @Author: liyujie
 * @Date: 2021/07/09
 * @Last Modified by: liyujie
 * @Last Modified time: 2021/07/09
-->
<template>
    <section class="wrapper">
        <el-dialog
            title="编辑客户类型"
            :visible.sync="dialogVisible"
            width="640px"
            :close-on-click-modal="false"
            @close="handleClose"
        >
            <div class="dialog-content">
                <div class="title">选择客户类型名称</div>
                <el-select
                    v-model="shop_group"
                    placeholder="请选择"
                    size="medium"
                    style="width: 512px"
                    clearable
                >
                    <el-option
                        v-for="item in shopGroupList"
                        :key="item.shop_group"
                        :label="item.title"
                        :value="item.shop_group"
                    />
                </el-select>
            </div>
            <div
                class="dialog-footer"
                style="padding-top: 12px"
            >
                <el-button
                    size="small"
                    style="width: 100px"
                    @click="dialogVisible = false"
                >
                    取消
                </el-button>
                <el-button
                    type="primary"
                    size="small"
                    style="width: 100px;margin-left: 52px"
                    :disabled="!shop_group"
                    @click="handleConfirm()"
                >
                    确定
                </el-button>
            </div>
        </el-dialog>
    </section>
</template>

<script>

export default {
    name: "SetCustomerTypeDialog",
    props: {
        shopGroupList: {
            type: Array,
            required: true
        }
    },
    data() {
        return {
            dialogVisible: false,
            shop_group: '',
        };
    },
    watch: {},
    computed: {},
    mounted() {},
    methods: {

        /**
         * 显示弹窗
         */
        show(shop_group) {
            this.dialogVisible = true;
            if(shop_group !== 0) {
                this.shop_group = shop_group;
            }
        },

        /**
         * 显示弹窗
         */
        close() {
            this.dialogVisible = false;
        },

        /**
         * 点击确定
         */
        handleConfirm() {
            this.$emit('confirm', this.shop_group);
        },

        /**
         * 弹窗关闭
         */
        handleClose() {
            this.shop_group = '';
        }
    }
};
</script>

<style scoped lang="less">
.wrapper {
    .dialog-content {
        display: flex;
        flex-direction: column;
        padding: 0 32px;
        .title {
            font-size: 14px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: rgba(0, 0, 0, 0.85);
            margin-bottom: 12px;
        }
    }
    .dialog-footer {
        display: flex;
        justify-content: center;
        margin-top: 24px;
    }
}

/deep/ .el-dialog__header {
    padding-top: 10px;
    box-shadow: 0 1px 0 0 rgba(233, 233, 233, 1);
    display: flex;
    align-items: center;
    background: #FAFAFA;
    border-radius: 4px 4px 0 0;

    .el-dialog__title {
        font-weight: 500;
        color: #333;
        font-size: 14px;
    }

    .el-icon-close:before {
        color: rgb(194, 194, 194);
        font-size: 17px;
        font-weight: bold;
    }

    .el-dialog__headerbtn {
        top: 14px;
    }
}

/deep/ .el-dialog__body {
    padding: 24px 32px;
}
</style>
